package com.eastfair.messagecenter.duty;

import cn.hutool.core.collection.CollectionUtil;
import com.eastfair.core.base.R;
import com.eastfair.messagecenter.exceptioncode.MessageServiceExceptionCode;
import com.eastfair.messagecenter.pipeline.BusinessProcess;
import com.eastfair.messagecenter.pipeline.ProcessContext;
import com.eastfair.messagecenter.pipeline.SendTaskModel;
import com.eastfair.messagecenter.point.ReadySendPoint;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * @author ligang
 * @date 2021/11/22
 * @description 黑名单校验
 */
@Slf4j
@Service
public class BlackParamCheckAction implements BusinessProcess<SendTaskModel> {

    @Override
    public void process(ProcessContext<SendTaskModel> context) {
        SendTaskModel sendTaskModel = context.getProcessModel();
        ReadySendPoint readySendPoint = sendTaskModel.getReadySendPoint();
        // TODO: 2022/9/12 黑名单校验
        //业务id为空
        if (readySendPoint.getBusinessId() == null) {
            context.setResponse(R.fail(MessageServiceExceptionCode.BUSINESS_CODE_IS_NULL));
            context.setNeedBreak(true);
        }
        
    }
}
